package com.hama.iotrust.common;

/**
 * 系统常量.
 * 
 * @author 金建强(ptma@163.com)
 * @version 1.0.0
 * @since 2013-4-2 22:45:58
 */
public class Constants {

    /** 页码参数 */
    public static final String  PARAM_PAGE       = "page";
    /** 分页大小参数 */
    public static final String  PARAM_PAGESIZE   = "pagesize";
    /** 默认分页. */
    public static final int     DEFAULT_PAGESIZE = 10;
    /** 登录用户标志 */
    public static final String  LOGIN_USER       = "LOGIN_USER";
    /** 登录用户IP地址 */
    public static final String  LOGIN_IP         = "LOGIN_IP";

    /** 启动权限控制 */
    public static final boolean USING_SECURITY   = false;

    public static final int     MODULE_TYPE_MENU = 1;
    
    public static final String DEFAULT_PASSWORD_TEACHER = "123456";
    
    public static final double ADDRE_CONST = 1;
    
    /** 机构端的编号 */
    public static final int WEB_ID_ORG = 0;
    /** 平台端的编号 */
    public static final int WEB_ID_PLAT = 1;
    /** 个人APP端的编号 */
    public static final int WEB_ID_APP = 2;
    /** session超时返回结果 */
    public static final int SESSION_TIMEOUT_RESULT = 3;
    /** 机构端登录url */
    public static final String ORG_LOGINURL = "/orgLogin.do";
    /** 平台端登录url */
    public static final String PLAT_LOGINURL = "/platLogin.do";


    public enum DeleteStatus{
        NOT_DELETED,DELETED
    }

    public enum AccuseStatus{
        NOT_ACCUSED,ACCUSED,SOLVED
    }

    /***
     * 0:机构，1：体验，2：回复,3:平台活动
     */
    public enum CommentType{
        ORG,ORGACT,REP,ACTIVITY;
        public static CommentType get(int order){
            if (ORG.ordinal()==order) {
                return ORG;
            }
            else if (ORGACT.ordinal()==order){
                return ORGACT;
            }else if (REP.ordinal()==order){
                return REP;
            }else if (ACTIVITY.ordinal()==order){
                return ACTIVITY;
            }else {
                throw  new ServiceException("评论类型错误。");
            }
        }
    }

    /**
     * 评论等级0：好评，1:中评，2:差评
     * */
    public enum CommentGrade{

        GOOD{
           public float[]  getInterval(){
                return new float[]{6.000001f,10};
            }
        },NORMAL{
            @Override
            public float[] getInterval() {
                return new float[]{3.000001f,6};
            }
        },WORSE {
            @Override
            public float[] getInterval() {
                return new float[]{0,3};
            }
        };
        public abstract float[] getInterval();
        public static   CommentGrade get(int order){
            if (GOOD.ordinal()==order) {
                return GOOD;
            }
            else if (NORMAL.ordinal()==order){
                return NORMAL;
            }else  if (WORSE.ordinal()==order){
                return WORSE;
            }else {
                throw new ServiceException("评论等级错误。");
            }
        }
    }

    public enum JoinActivityStatus{
        NOT_JOIN,NOT_PAYED,PAYED;
    }
}
